package com.example.demo.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.example.demo.custom.BaseRepository;
import com.example.demo.entity.SysUser;
import com.example.demo.entity.TargetAndBackMonkey2;
import com.example.demo.entity.TargetAndBackMonkeyPeople;
import com.example.demo.entity.TargetAndBackMonkeyPeople2;
import com.example.demo.entity.TargetAndBackMonkeyPeopleDate;
@Repository
public interface TargetAndBackMonkeyPeopleRepository extends BaseRepository<TargetAndBackMonkeyPeople, Integer>{

	List<TargetAndBackMonkeyPeople> findByUser1(TargetAndBackMonkeyPeople2 sale1);

	List<TargetAndBackMonkeyPeople> findByUser1Id(Integer userId);

	/**
	 * @param car
	 * @return 通过时间排序得到最新一条
	 */
	@Query(value = "SELECT  *  FROM target_and_back_monkey_people t WHERE t.user1_id=? ORDER BY t.begin_date DESC LIMIT 1 ",nativeQuery=true)
	TargetAndBackMonkeyPeople findByUser1Id2(Integer id);





}
